<route lang="yaml">
	meta:
	enabled: false
</route>

<script setup lang="ts">
	import { onMounted, ref } from 'vue'
	import type { UploadProps } from 'element-plus'
	import { ElMessage, ElMessageBox } from 'element-plus'
	import dayjs from 'dayjs'
	import { useRoute } from 'vue-router'
	import orderApi from '@/api/zhitan/order.ts'
	import storage from '@/utils/storage'
	import useUserStore from '@/store/modules/user'
	import BigNumber from 'bignumber.js';

	const userStore : any = useUserStore()
	const router = useRouter()
	const route = useRoute()
	const images = ref([
		'https://picsum.photos/400',
		'https://picsum.photos/600',
	])
	// const handleSuccess2: UploadProps['onSuccess'] = (res: any) => {
	//   if (res.error === '') {
	//     images.value.push(res.data.path)
	//   }
	//   else {
	//     ElMessage.warning(res.error)
	//   }
	// }
	const formRules = ref({
		dec: [
			{ required: true, message: '请输入备注', trigger: 'blur' },
		],
		code: [
			{ required: true, message: '请输入核销码', trigger: 'blur' },
		],
		hxy_name: [
			{ required: true, message: '请选择核销员', trigger: 'blur' },
		],

	})

	const formremark : any = ref({
		remark: '',
	})
	const form : any = ref({
		desc: '',
	})

	const openShowRefound : any = ref(false)
	const orderForm : any = ref({})
	const activities : any = ref([])
	const dataList : any = ref([])
	onMounted(() => {
		console.log('route:', route.query.id)
		if (route.query.id) {
			form.value.id = route.query.id.toString()
			getinfo()
		}
	})

	function getinfo() {
		orderApi.order_info({ id: form.value.id }).then((res : any) => {
			console.log(res, 'getinfo()')
			if (res) {
				if (res.check_time && res.check_time > 0) {
					activities.value = []
					if (res.pay_time) {
						activities.value.push({ content: '下单时间', timestamp: dayjs(res.pay_time * 1000).format('YYYY-MM-DD HH:mm:ss') })
					}
					if (res.check_time) {
						activities.value.push({ content: '核销时间', timestamp: dayjs(res.check_time * 1000).format('YYYY-MM-DD HH:mm:ss') })
					}
				} else {
					activities.value = []
					if (res.pay_time) {
						activities.value.push({ content: '下单时间', timestamp: dayjs(res.pay_time * 1000).format('YYYY-MM-DD HH:mm:ss') })
					}
					if (res.refund_time) {
						activities.value.push({ content: '退款申请时间', timestamp: dayjs(res.refund_time * 1000).format('YYYY-MM-DD HH:mm:ss') })
					}
					if (res.refund_pass_time) {
						activities.value.push({ content: '实际退款成功时间', timestamp: dayjs(res.refund_pass_time * 1000).format('YYYY-MM-DD HH:mm:ss') })
					}
					if (!res.refund_pass_time && res.refusal_refund_time) {
						activities.value.push({ content: '拒绝退款时间', timestamp: dayjs(res.refusal_refund_time * 1000).format('YYYY-MM-DD HH:mm:ss') })
					}

				}

				// if (res.data.gift_json) {
				// 	res.data.gift_json = JSON.parse(res.data.gift_json)
				// }
				dataList.value = [res]
				form.value = res

				form.value.back_desc = form.value.back_desc ? JSON.parse(form.value.back_desc) : []
			}

		})
	}
	// 返回列表页
	function goBack() {
		router.go(-1)
	}
	function saveRemark() {
		if (!formremark.value.remark) {
			ElMessage({
				type: 'info',
				message: '请添加备注内容',
			})
			return
		}
		const userinfo : any = storage.local.get('userinfo')
		const tenDigitTimestamp : any = Math.floor(Date.now() / 1000);
		console.log(userinfo, 'getinfo()1')
		form.value.back_desc = form.value.back_desc ? form.value.back_desc : []
		formremark.value.time = tenDigitTimestamp
		console.log(userinfo, storage.local.get('userinfo'), 'userinfouserinfo')
		formremark.value.username = JSON.parse(userinfo).username

		form.value.back_desc.unshift(JSON.parse(JSON.stringify(formremark.value)))
		formremark.value.remark = ""
		console.log(form.value.back_desc, 'getinfo()')
		const str : any = JSON.stringify(form.value.back_desc)
		orderApi.order_edit({ id: form.value.id, back_desc: str }).then((res : any) => {
			console.log(res, 'getinfo()')
			if (res.code === 0) {
				getinfo()
			}

		})
	}
	function saveImages() {
		// const str = JSON.stringify(form.value.desc)
		// orderApi.order_edit({ id: form.value.id, desc: str }).then((res : any) => {
		// 	console.log(res, 'getinfo()')
		// 	if (res.code === 0) {
		// 		getinfo()
		// 	}

		// })
	}

	function refundmoney(row : any) {
		orderForm.value = JSON.parse(JSON.stringify(row))
		orderForm.value.refund_money = orderForm.value.reality_price / 100
		orderForm.value.refuse_msg = ""
		orderForm.value.refoundtype = 1
		openShowRefound.value = true
	}
	function submitedit() {
		// if (!orderForm.value.refound_msg) {
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '请添加退款原因',
		// 	})
		// 	return
		// }
		// if (!orderForm.value.images) {
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '请添加退款备注图片',
		// 	})
		// 	return
		// }
		// if (orderForm.value.refund_money < 0) {
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '退款金额不可为负数',
		// 	})
		// 	return
		// }
		// if (!orderForm.value.refund_money) {
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '请输入退款金额',
		// 	})
		// 	return
		// }
		// console.log(orderForm.value.refund_money , Number(orderForm.value.reality_price),'lll')
		// if (Number(orderForm.value.refund_money) > Number(orderForm.value.reality_price) / 100) {
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '退款金额不可大于实际支付金额',
		// 	})
		// 	return
		// }
		// orderApi.order_edit({ id: orderForm.value.id,refund_money: Number(orderForm.value.refund_money)*100,  refuse_msg: orderForm.value.refound_msg, status: 4, image: orderForm.value.images.join(',') }).then((res : any) => {
		// 	console.log(res, 'getinfo()')
		// 	if (res.code === 0) {
		// 		openShowRefound.value = false 
		// 	}
		// })
		if (orderForm.value.status === 3) {
			if (orderForm.value.refoundtype === 1) {
				orderApi.order_refund({ id: orderForm.value.id, money: new BigNumber(Number(orderForm.value.refund_money)).times(100).toNumber(), refund_policy: orderForm.value.refund_policy ? orderForm.value.refund_policy : "" }).then((res : any) => {
					if (res.code === 0) {
						openShowRefound.value = false
						getinfo()
						ElMessage({
							type: 'success',
							message: '操作成功',
						})
					}

				})
			} else {
				orderApi.order_refuseRefund({ id: orderForm.value.id, refuse_msg: orderForm.value.refuse_msg }).then((res : any) => {
					if (res.code === 0) {
						openShowRefound.value = false
						getinfo()
						ElMessage({
							type: 'success',
							message: '操作成功',
						})
					}

				})
			}
		} else {
			orderApi.order_refund({ id: orderForm.value.id, money: new BigNumber(Number(orderForm.value.refund_money)).times(100).toNumber(), refund_policy: orderForm.value.refund_policy ? orderForm.value.refund_policy : "" }).then((res : any) => {
				if (res.code === 0) {
					openShowRefound.value = false
					getinfo()
					ElMessage({
						type: 'success',
						message: '操作成功',
					})
				}

			})
		}



	}

	function handleSuccess01(res : any) {
		if (res) {
			orderForm.value.images = orderForm.value.images || []
			orderForm.value.images.push(res)
		}
		else {
			// ElMessage.warning(res.error)
		}
	}
</script>

<template>
	<div class="add">
		<page-header title="订单详情">
			<el-button size="default" round @click="goBack">
				<template #icon>
					<svg-icon name="ep:arrow-left" />
				</template>
				返回
			</el-button>
		</page-header>
		<div>
			<!-- style="height: calc(100vh - 290px);overflow-y: auto;" -->
			<page-main>
				<el-steps :active="form.status===0?0:(form.status!==0&& form.status!==2)?1:2" align-center>
					<el-step :title="form.status===0?'未付款':'已付款'"
						:description="`${form.create_time>0? dayjs(form.create_time * 1000).format('YYYY-MM-DD HH:mm:ss'):''}`" />
					<el-step title="已核销"
						:description="`${form.check_time>0? dayjs(form.check_time * 1000).format('YYYY-MM-DD HH:mm:ss'):''}`" />
					<!-- <el-step title="提交订单" description="2022-12-23 23:11:0" />
          <el-step title="支付订单" description="2022-12-23 23:11:0" />
          <el-step title="平台发货" description="" />
          <el-step title="确认收货" description="" />
          <el-step title="完成评价" description="" /> -->
				</el-steps>
			</page-main>
			<page-main class="mt-4">
				<template #title>
					订单详情
				</template>
				<div class="table-wrap">
					<el-row class="head">
						<el-col :sm="24" :md="16">
							<div class="d-s-c flex-1">
								<div class="fb">
									支付状态：<span class="gray6 fbn">{{form.is_pay===0?'未付款':'已付款'}}</span>
								</div>
								<!-- <div class="fb ml-2.5 mr-8">
                  售后状态：<span class="success fbn">正常</span>
                </div> -->
							</div>
						</el-col>
						<!-- <el-col :sm="24" :md="8" class="tr">
              <el-button type="primary">
                修改状态
              </el-button>
              <el-button plain>
                修改收货人信息
              </el-button>
              <el-button plain>
                修改费用信息
              </el-button>
            </el-col> -->
					</el-row>
					<el-row :gutter="20" style="margin: 20px 10px;">
						<el-col :sm="12" :md="6">
							<div class="f16 fb">
								订单信息
							</div>
							<div class="mt-2.5">
								<span class="tt gray9">订单号：</span>{{form.order_code}}

							</div>
							<div class="mt-2">
								<span class="tt gray9">订单状态：</span><el-tag type="info" class="ml-2.5"
									v-if="form.status===0">
									待支付
								</el-tag>
								<el-tag type="primary" class="ml-2.5" v-if="form.status===1">
									待使用
								</el-tag>
								<el-tag type="success" class="ml-2.5" v-if="form.status===2">
									已核销
								</el-tag>
								<el-tag type="danger" class="ml-2.5" v-if="form.status===3">
									退款申请中
								</el-tag>
								<el-tag type="info" class="ml-2.5" v-if="form.status===4">
									已退款
								</el-tag>
								<el-tag type="warning" class="ml-2.5" v-if="form.status===5">
									拒绝退款
								</el-tag>
								<el-tooltip v-if="form.status===5" class="box-item" effect="dark"
									:content="form.refuse_msg" placement="top-start">
									<svg-icon name="ep:question-filled" />
								</el-tooltip>
							</div>
							<div class="mt-2">
								<span class="tt gray9">订单类型：</span><el-tag type="info" class="ml-2.5"
									v-if="form.type===1">
									单独购买
								</el-tag>
								<el-tag type="primary" class="ml-2.5" v-if="form.type===2">
									约伴（发起者）
								</el-tag>
								<el-tag type="success" class="ml-2.5" v-if="form.type===3">
									约伴（参与者）
								</el-tag>
							</div>
							<div class="mt-2">
								<span class="tt gray9">会员ID：</span>{{form.applet_user_id}}
							</div>
							<div class="mt-2">
								<span
									class="tt gray9">会员账号：</span>{{form.applet_user_info&&form.applet_user_info.nick_name?form.applet_user_info.nick_name:''}}
							</div>
							<div class="mt-2">
								<span class="tt gray9">产品数量：</span>{{form.num}}
							</div>
							<div class="mt-2">
								<span
									class="tt gray9">下单时间：</span>{{form.create_time>0? dayjs(form.create_time * 1000).format('YYYY-MM-DD HH:mm:ss'):''}}
							</div>
						</el-col>
						<el-col :sm="12" :md="6">
							<div class="f16 fb">
								支付信息
							</div>
							<div class="mt-2.5">
								<span
									class="tt gray9">付款时间：</span>{{form.pay_time>0? dayjs(form.pay_time * 1000).format('YYYY-MM-DD HH:mm:ss'):''}}
							</div>
							<div class="mt-2.5">
								<span class="tt gray9">产品合计：</span>￥{{(form.price*form.num)/100}}
							</div>
							<div class="mt-2">
								<span
									class="tt gray9">优惠券：</span>{{form.coupon_id>0?`${form.coupon_info.name}(${form.coupon_info.money/100}元券)`:'未使用'}}
							</div>
							<div class="mt-2">
								<span class="tt gray9">订单应付：</span>￥{{form.reality_price/100}}
							</div>
							<div class="mt-2">
								<span class="tt gray9">订单实付：</span>￥{{form.reality_price/100}}
							</div>
							<div class="mt-2">
								<span class="tt gray9">用户备注：</span>{{form.desc || '-'}}
							</div>

						</el-col>
						<!-- <el-col :sm="12" :md="6">
							<div class="f16 fb">
								分销信息
							</div>
							<div class="mt-2.5" v-if="form.invite_applet_user_id>0">
								<span
									class="tt gray9">推荐人：</span>{{form.invite_applet_user_info&&form.invite_applet_user_info.nick_name?form.invite_applet_user_info.nick_name:""}}
							</div>
							<div class="mt-2">
								<span
									class="tt gray9">分销类型：</span>{{form.retail_type===1?'固定分成':form.retail_type===2?'阶梯分成':form.retail_type===3?'单产品佣金':''}}
							</div>

							<div class="mt-2" v-if="form.invite_applet_user_id>0">
								<span
									class="tt gray9">佣金金额：</span>￥{{form.invite_brokerage?form.invite_brokerage/100:'0.00'}}
							</div>
							<div class="mt-2"
								v-if="form.invite_applet_user_id>0 && (form.retail_type===1 || form.retail_type===2)">
								<span class="tt gray9">佣金比例：</span>{{form.percent?form.percent:'0'}}%
							</div>
							<div class="mt-2" v-if="form.invite_applet_user_id===0">
								<span class="tt gray9">无</span>
							</div>
						</el-col> -->
						<el-col :sm="12" :md="6">
							<div class="f16 fb">
								合同信息
							</div>
							<div class="mt-2.5">
								<span class="tt gray9">合同模板：</span>{{form.pact_info?form.pact_info.name:'未绑定合同'}}
							</div>
							<div class="mt-2">
								<span class="gray9">约伴：</span>{{form.group_id>0?'已约伴':'未约伴'}}

							</div>
							<div class="mt-2">
								<span
									class="gray9">排期：</span>{{form&&form.product_schedule_info&&form.product_schedule_info.name?form.product_schedule_info.name:''}}

							</div>
						</el-col>
						<el-col :sm="12" :md="6">
							<div class="f16 fb">
								其他信息
							</div>
							<div class="mt-2.5">
								<span class="gray9">积分发放状态：</span>
								<el-tag type="info" class="ml-2.5" v-if="form.Integrate_send_status===0">
									无需发放
								</el-tag>
								<el-tag type="primary" class="ml-2.5" v-if="form.Integrate_send_status===1">
									未发放
								</el-tag>
								<el-tag type="success" class="ml-2.5" v-if="form.Integrate_send_status===2">
									已发放
								</el-tag>
							</div>
							<div class="mt-2" v-if="form.Integrate_send_status===2">
								<span class="tt gray9">发放积分：</span>{{form.Integrate}}
							</div>
							<div class="mt-2.5">
								<span class="gray9">约伴成功后赠送优惠券发放状态：</span>
								<el-tag type="info" class="ml-2.5" v-if="form.group_coupon_send_status===0">
									无需发放
								</el-tag>
								<el-tag type="primary" class="ml-2.5" v-if="form.group_coupon_send_status===1">
									未发放
								</el-tag>
								<el-tag type="success" class="ml-2.5" v-if="form.group_coupon_send_status===2">
									已发放
								</el-tag>
							</div>
							<div class="mt-2" v-if="form.group_coupon_send_status===2">
								<span
									class="gray9">发放优惠券：</span>{{`${form.group_coupon_info.name}(${form.group_coupon_info.money/100}元券)`}}

							</div>
							<div class="mt-2.5">
								<span class="gray9">优惠券发放状态：</span>
								<el-tag type="info" class="ml-2.5" v-if="form.coupon_send_status===0">
									无需发放
								</el-tag>
								<el-tag type="primary" class="ml-2.5" v-if="form.coupon_send_status===1">
									未发放
								</el-tag>
								<el-tag type="success" class="ml-2.5" v-if="form.coupon_send_status===2">
									已发放
								</el-tag>
							</div>
							<div class="mt-2" v-if="form.coupon_send_status===2">
								<span
									class="gray9">发放优惠券：</span>{{`${form.fulfill_coupon_info.name}(${form.fulfill_coupon_info.money/100}元券)`}}

							</div>


						</el-col>
					</el-row>
				</div>
			</page-main>
			<page-main class="mt-4">
				<template #title>
					人员信息
				</template>
				<div class="table-wrap">
					<el-row :gutter="24" style="margin: 20px 10px;">
						<el-col :sm="24" :md="24">
							<div class="f16 fb">
								监护人信息
							</div>
							<div class="mt-2">
								<span
									class="gray9">监护人：</span>{{form&&form.guardian_info&&form.guardian_info.name?form.guardian_info.name:''}}
							</div>
							<div class="mt-2">
								<span class="gray9">证件类型：</span>
								<el-tag type="primary" class="ml-2.5"
									v-if="form&&form.guardian_info&&form.guardian_info.certificate_type===1">
									身份证
								</el-tag>
								<el-tag type="success" class="ml-2.5"
									v-if="form&&form.guardian_info&&form.guardian_info.certificate_type===2">
									护照
								</el-tag>
								<el-tag type="danger" class="ml-2.5"
									v-if="form&&form.guardian_info&&form.guardian_info.certificate_type===3">
									港澳通行证
								</el-tag>
								<el-tag type="info" class="ml-2.5"
									v-if="form&&form.guardian_info&&form.guardian_info.certificate_type===4">
									台胞证
								</el-tag>
								<el-tag type="warning" class="ml-2.5"
									v-if="form&&form.guardian_info&&form.guardian_info.certificate_type===5">
									其他证件
								</el-tag>
							</div>
							<div class="mt-2">
								<span
									class="gray9">证件号：</span>{{form&&form.guardian_info&&form.guardian_info.id_number?form.guardian_info.id_number:''}}
							</div>
							<div class="mt-2">
								<span
									class="gray9">关系：</span>{{form&&form.guardian_info&&form.guardian_info.relation_name?form.guardian_info.relation_name:''}}
							</div>
							<div class="mt-2">
								<span
									class="gray9">联系电话：</span>{{form&&form.guardian_info&&form.guardian_info.phone?form.guardian_info.phone:''}}
							</div>
							<div class="mt-2">
								<span
									class="gray9">小程序用户id：</span>{{form&&form.guardian_info&&form.guardian_info.applet_user_id?form.guardian_info.applet_user_id:''}}
							</div>

						</el-col>
					</el-row>
				</div>
				<div class="table-wrap mt-6">
					<el-row :gutter="24" style="margin: 20px 10px;">
						<el-col :sm="24" :md="24">
							<div class="f16 fb">
								营员信息
							</div>
							<!--  -->
							<div class="mt-2 flex flex-wrap items-center"
								v-if="form.camper_list && form.camper_list.length>0">
								<div class="mb-6 w-25%" v-for="(i,j) in form.camper_list" :key="j">
									<div>
										<span class="gray9 min-w-12">营员：</span> {{i.name}}
									</div>
									<div class="mt-2">
										<span class="gray9 min-w-12">证件类型：</span> <el-tag type="primary" class="ml-2.5"
											v-if="i.certificate_type===1">
											身份证
										</el-tag>
										<el-tag type="success" class="ml-2.5" v-if="i.certificate_type===2">
											护照
										</el-tag>
										<el-tag type="danger" class="ml-2.5" v-if="i.certificate_type===3">
											港澳通行证
										</el-tag>
										<el-tag type="info" class="ml-2.5" v-if="i.certificate_type===4">
											台胞证
										</el-tag>
										<el-tag type="warning" class="ml-2.5" v-if="i.certificate_type===5">
											其他证件
										</el-tag>
									</div>
									<div class="mt-2">
										<span class="gray9">证件号：</span>{{i.id_number||''}}
									</div>
									<!-- <div class="mt-2">
										<span class="gray9">关系：</span>{{i.relation_name||''}}
									</div> -->
									<div class="mt-2">
										<span class="gray9">小程序用户id：</span>{{i.applet_user_id||''}}
									</div>
								</div>
							</div>
							<div class="mt-2 flex flex-wrap items-center" v-else>暂无营员</div>
						</el-col>
					</el-row>
				</div>
			</page-main>
			<el-row :gutter="20" style="margin: -10px 10px 10px;">
				<el-col :md="8">
					<page-main style="margin: 10px 0;">
						<template #title>
							订单日志
						</template>
						<el-timeline style="height: 200px;overflow-y: auto;">
							<el-timeline-item v-for="(activity, index) in activities" :key="index"
								:timestamp="activity.timestamp">
								{{ activity.content }}
							</el-timeline-item>
						</el-timeline>
					</page-main>
				</el-col>
				<el-col :md="8">
					<page-main style="margin: 10px 0;" class="notes">
						<template #title>
							<div class="flex justify-between">
								<div>备注</div>
								<!-- <div><el-button type="primary" @click="saveImages">
										保存备注
									</el-button></div> -->
							</div>
						</template>
						<div class="" style="height: 190px;overflow-y: auto;">
							<div class="flex d-c py-1" style="line-height: 32px; border-bottom: 1px solid #ddd;"
								v-for="(i,j) in form.back_desc">
								<div class="flex  justify-between items-center font-size-3.5 c-[#666]">
									<!-- <div class="w-6 flex justify-center items-center mr-1 mt-1 h-6 c-[#fff] bg-[#4280EB]"
										style="border-radius: 50%;">{{j+1}}</div> -->
									<div>添加人：{{i.username}}</div>
									<div class="ml-4">
										{{i.time>0? dayjs(i.time * 1000).format('YYYY-MM-DD HH:mm:ss'):'' }}
									</div>
								</div>

								<div style="width:95%;">{{i.remark}}</div>
							</div>
						</div>

					</page-main>
				</el-col>
				<el-col :md="8">
					<page-main style="margin: 10px 0;">
						<template #title>
							新增备注
						</template>
						<el-form :model="formremark" label-width="0">
							<el-form-item label="" class="textarea">
								<el-input v-model="formremark.remark" type="textarea" placeholder="请输入备注内容"
									style="min-height: 80px;" />
							</el-form-item>
							<el-form-item style="margin-bottom: 0;">
								<el-button type="primary" @click="saveRemark">
									保存备注
								</el-button>
							</el-form-item>
						</el-form>
					</page-main>
				</el-col>
			</el-row>
			<page-main class="mt-4">
				<template #title>
					订单产品
				</template>
				<el-table :data="dataList" border>
					<el-table-column prop="product_name" label="产品" min-width="400">
						<template #default="scope">
							<div class="product-info">
								<div class="d-s-c">
									<!-- <image-preview style="width: 60px;height: 40px;" :src="scope.row.image" /> -->
									<image-preview :width="60" :height="40" :src="scope.row.image" />
									<div
										style="display: flex;justify-content: space-between;width: calc(100% - 52px);margin-left: 10px;">
										<div>
											<div class="name">
												{{ scope.row.name }}
											</div>
											<!-- <div style="font-size: 12px;">
                        150ml/瓶
                      </div> -->
											<div style="font-size: 12px;">
												数量：{{ scope.row.num }}
											</div>
											<div style="font-size: 12px;"
												class="gray6  mt-0.5 flex items-center  text-ellipsis">
												赠送优惠券：
												<div v-if="scope.row.fulfill_coupon_info">
													{{scope.row.fulfill_coupon_info.name}}（￥{{scope.row.fulfill_coupon_info.money/100}}）
													<!-- <div>
																										<div>
																											<div>
																												￥
																											</div>
																											<div>
																												{{i.fulfill_coupon_info.money}}
																											</div>
																										</div>
																										<div>
												<div>
												
																										</div>
																										</div>
																									</div> -->
												</div>
												<div v-else>
													无赠品
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="total_price" label="价格信息" width="240">
						<template #default="scope">
							<p>产品原价：￥ {{ scope.row.original_price/100 }}</p>
							<p>产品划线价：￥ {{ scope.row.scribing_price/100 }}</p>
							<p>产品实付：￥ {{ scope.row.reality_price/100 }}</p>
						</template>
					</el-table-column>
					<!-- <el-table-column prop="total_price" label="优惠信息" width="180">
						<template #default="scope">
							<p v-if="scope.row.invite_applet_user_id>0">优惠：￥
								{{ scope.row.invite_applet_user_id>0?((scope.row.original_price*scope.row.num)-(scope.row.price*scope.row.num))/100:0}}
							</p>
						</template>
					</el-table-column> -->
					<!-- <el-table-column prop="total_price" label="佣金信息" width="210">
						<template #default="scope">
							<div v-if="scope.row.invite_applet_user_id>0">
								<p>类型： {{scope.row.retail_type===1?'固定分成':scope.row.retail_type===2?'阶梯分成':scope.row.retail_type===3?'单产品佣金':''}}
					</p>
					<p class="f14">
						级别：{{scope.row.lv?scope.row.lv:'-'}}
					</p>
					<p class="f14" v-if="scope.row.retail_type===1 || scope.row.retail_type===2">
						收款比例：{{scope.row.percent}}%
					</p>
		</div>
</template>
</el-table-column>
<el-table-column prop="total_price" label="返佣信息" width="250">
	<template #default="scope">
		<div class="d-s-c" v-if="scope.row.invite_applet_user_id>0">
			<image-preview style="width: 60px;height: 60px;"
				:src="scope.row.invite_applet_user_info?scope.row.invite_applet_user_info.avatar:'1'" />
			<div style="display: flex;justify-content: space-between;width: calc(100% - 52px);margin-left: 10px;">
				<div>
					<div class="name">
						昵称：{{scope.row.invite_applet_user_info?scope.row.invite_applet_user_info.nick_name:'-'}}
					</div>
					<div class="name">
						手机号：{{scope.row.invite_applet_user_info?scope.row.invite_applet_user_info.phone:'-'}}
					</div>
					<div class="gray6 name mt-0.5 text-ellipsis">
						返佣金额：{{scope.row.invite_brokerage?scope.row.invite_brokerage/100:0}}元
					</div>
				</div>
			</div>
		</div>
	</template>
</el-table-column> -->
					<el-table-column label="订单状态" width="110" align="center">
						<template #default="scope">
							<el-tag type="info" v-if="scope.row.status===0">
								待支付
							</el-tag>
							<el-tag type="primary" v-if="scope.row.status===1">
								待使用
							</el-tag>
							<el-tag type="success" v-if="scope.row.status===2">
								已核销
							</el-tag>
							<!-- <el-tag type="success" v-if="scope.row.status!==2">
								未核销
							</el-tag> -->
							<el-tag type="danger" v-if="scope.row.status===3">
								退款申请中
							</el-tag>
							<el-tag type="info" v-if="scope.row.status===4">
								已退款
							</el-tag>
							<el-tag type="warning" v-if="scope.row.status===5">
								拒绝退款
							</el-tag>
							<el-tooltip v-if="scope.row.status===5" class="box-item" effect="dark"
								:content="scope.row.refuse_msg" placement="top-start">
								<svg-icon name="ep:question-filled" />
							</el-tooltip>
						</template>
					</el-table-column>
					<el-table-column label="退款金额" width="110" align="center" v-if="form.status===4">
						<template #default="scope">
							<div>
								{{scope.row.refund_money/100}}
							</div>
						</template>
					</el-table-column>

					<!--  -->
					<el-table-column fixed="right" width="170" align="center" label="操作"
						v-if="form.status===3 && userStore.permissions.includes('ordermanagementrefund')">
						<template #default="scope">
							<el-button type="primary" text @click="refundmoney(scope.row)">
								退款
							</el-button>
						</template>
					</el-table-column>
					<el-table-column fixed="right" width="170" align="center" label="操作"
						v-if="form.status===1 && userStore.permissions.includes('ordermanagementforcerefund')">
						<template #default="scope">
							<el-button type="primary" text @click="refundmoney(scope.row)">
								未成团退款
							</el-button>
						</template>
					</el-table-column>
				</el-table>
			</page-main>
		</div>
		<!-- <fixed-action-bar>
      <el-button size="large" @click="onCancel">
        取消
      </el-button>
    </fixed-action-bar> -->
		<!-- 取消订单 -->
		<el-dialog v-model="openShowRefound" :title="`${orderForm.status===1?'未成团退款':'订单退款'}`" width="460px">
			<el-form ref="formRef" :rules="formRules" :model="orderForm" label-width="85px">
				<el-form-item label="产品状态：" prop="refoundtype" v-if="orderForm.status===3">
					<el-radio-group v-model="orderForm.refoundtype">
						<el-radio :value="1">
							同意退款
						</el-radio>
						<el-radio :value="2">
							拒绝退款
						</el-radio>
					</el-radio-group>
				</el-form-item>
				<el-form-item label="拒绝退款原因: " label-width="90px" v-if="orderForm.refoundtype===2">
					<el-input v-model="orderForm.refuse_msg" type="textarea" />
				</el-form-item>
				<el-form-item label="退款金额: " label-width="90px" v-if="orderForm.refoundtype===1">
					<!-- <el-input v-model="orderForm.money" type="number" /> -->
					<el-input-number v-model="orderForm.refund_money" style="width: 100%;" size="large"
						placeholder="请输入退款金额" :min="0" :max="999999999" controls-position="right" />
				</el-form-item>
				<el-form-item label="退费政策: " label-width="90px" v-if="orderForm.refoundtype!==2">
					<el-input v-model="orderForm.refund_policy" :rows="4" type="textarea" />
				</el-form-item>
				<!-- <el-form-item label="退款备注图片" label-width="110px">
					<ImagesUpload v-model:url="orderForm.images" :width="80" :height="80" :max='9'
						@on-success="handleSuccess01($event)" />
				</el-form-item>
				 -->
			</el-form>
			<template #footer>
				<el-button @click="openShowRefound = false">
					取消
				</el-button>
				<el-button type="primary" @click="submitedit()">
					确定
				</el-button>
			</template>
		</el-dialog>
	</div>
</template>

<style scoped lang="scss">
	.page-main {
		margin: 0 20px 20px;
	}

	.notes {
		:deep(.el-image) {
			width: 100px !important;
			height: 100px !important;
		}

		:deep(.image-slot) {
			width: 100px !important;
			height: 100px !important;
		}

		:deep(.el-upload__tip) {
			display: none !important;
		}
	}

	.table-wrap {
		padding-bottom: 6px;
		font-size: 14px;
		border: 1px solid #eee;
		border-radius: 4px;

		.head {
			padding: 12px;
			line-height: 32px;
			background-color: #eee;
		}

		.tt {
			display: inline-block;
			width: 70px;
		}
	}

	.textarea {
		:deep(.el-textarea__inner) {
			min-height: 150px !important;
		}
	}

	.el-table__row p {
		margin: 2px 0;
	}
</style>